PATHMac OS 8 and 9 Developer Documentation > Human Interface Toolbox > Window Manager >

Programming With the Mac OS 8.5 Window Manager


Tracking a Window Proxy Icon Drag

A mouse-down event in the proxy icon region of a document window can indicate that the user either wishes to drag the proxy icon or wishes to display the path pop-up menu for the window. Listing 2-5 in Displaying a Window Path Pop-Up Menu provides an example of how your application can respond to receiving the inProxyIcon result from the FindWindow function if the user is not dragging the proxy icon.

If the user is dragging the proxy icon, your application can use Window Manager-supplied functions to handle the drag process. If the proxy icon represents a type of object (currently, file system entities such as files, folders, and volumes) that the Window Manager supports, the Window Manager can handle all aspects of the drag process itself, and your application should simply call the function TrackWindowProxyDrag , as shown in Listing 2-4 . If your application calls the TrackWindowProxyDrag function it does not have to call the Drag Manager function WaitMouseMoved before starting to track the drag, as the Window Manager handles this automatically.

If the proxy icon represents an object type other than a file (other object types are currently not handled by the Window Manager), or if you wish to implement custom dragging behavior, your application should call the function TrackWindowProxyFromExistingDrag . The TrackWindowProxyFromExistingDrag function accepts an existing drag reference and adds file data if the window contains a file proxy.

If your application uses TrackWindowProxyFromExistingDrag , you have the choice of using this function in conjunction with the functions BeginWindowProxyDrag and EndWindowProxyDrag or simply calling TrackWindowProxyFromExistingDrag and handling all aspects of creating and disposing of the drag yourself.

Listing 2-4 Tracking a window proxy icon drag within the event loop

case inProxyIcon:

// We've seen a hit in the window proxy area, so drag the proxy icon

// Note that we don't check that the
// window is an app window, but you should

{
    OSStatus status = TrackWindowProxyDrag( pWindow, pEvent->where );
    if( status == errUserWantsToDragWindow )
        handled = false;
    else if( status == noErr )
        handled = true;
}
// Fall through to checking whether the user
// wants to display a window path pop-up menu


© 1999 Apple Computer, Inc. – (Last Updated 18 March 99)